package xidw_router

import (
	"server/apps/xidw/xidw_api"
	"server/middleware"

	"github.com/gin-gonic/gin"
)

type UserRouter struct{}

func (s *UserRouter) InitUserRouter(Router *gin.RouterGroup) {
	userRouter := Router.Group("user").Use(middleware.OperationRecord())
	userRouterWithoutRecord := Router.Group("user")
	baseApi := xidw_api.BaseApi{}
	{
		userRouter.POST("admin_register", baseApi.Register)
		userRouter.POST("changePassword", baseApi.ChangePassword)
		userRouter.POST("setUserAuthority", baseApi.SetUserAuthority)
		userRouter.DELETE("deleteUser", baseApi.DeleteUser)
		userRouter.PUT("setUserInfo", baseApi.SetUserInfo)
		userRouter.PUT("setSelfInfo", baseApi.SetSelfInfo)
		userRouter.POST("setUserAuthorities", baseApi.SetUserAuthorities)
		userRouter.POST("resetPassword", baseApi.ResetPassword)
	}
	{
		userRouterWithoutRecord.POST("getUserList", baseApi.GetUserList)
		userRouterWithoutRecord.GET("getUserInfo", baseApi.GetUserInfo)
		userRouterWithoutRecord.GET("getUserDict", baseApi.GetUserDict)
	}
}
